package com.atguigu.foreach;

public class TestDifferent {
    public static void main(String[] args) {
        //区别
//        (1)普通for循环有下标，增强for循环没有下标
//        （2）普通for循环可以替换修改元素，增强for循环不可以替换修改元素

        int[] arr = {10, 20, 30, 40, 50};
        //普通for循环
        for (int i = 0; i < arr.length; i++) {
            arr[i] *= 2;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();

        int[] nums = {10, 20, 30, 40, 50};
        //增强for循环
        for (int element : nums) {
            element *= 2;
        }
        for (int element : nums) {
            System.out.print(element+" ");
        }
        System.out.println();
    }
}
